function loadImg (src) {
  let promise = new Promise(function(resolve, reject) {
    let img = document.createElement('img')
    img.onload = function() {
      resolve(img)
    }
    img.onerror = function(err) {
      reject(err)
    }
    img.src = src
  })

  return promise
}

let src = 'https://ss1.bdstatic.com/5aAHeD3nKgcUp2HgoI7O1ygwehsv/media/ch1/jpg/guoqingjie%E8%83%8C%E6%99%AF.jpg'
let result = loadImg(src)

result.then(function(img) {
  alert(`width: ${img.width}`)
  return img
}).then(function(img) {
  alert(`height: ${img.height}`)
  return img
}).catch(function(e) {
  alert(e)
}) 